<?php
class Web_Form_Login
	extends Zend_Form
{   
    public function init ($timeout=60)
    {
    	
    	$this->setName("loginForm");
    	
        $email = new Zend_Form_Element_Text('email'); 
        $email->setLabel('Email');
        $email->setAttrib('class', 'email');
        $email->setRequired(true);
        $email->addValidator(new Zend_Validate_EmailAddress());
        
		$password = new Zend_Form_Element_Password('password'); 
		$password->setLabel('Clave');
		$password->setAttrib('class', 'clave');
        $password->setRequired(true);
        
        $submit = new Zend_Form_Element_Submit('submit'); 
        $submit->setLabel('Entrar');
        
        $this->addElement($email);
        $this->addElement($password);
        $this->addElement($submit);
        
    }
    
	public function loadDefaultDecorators()	{
		
		$elements = $this->getElements();
		unset($elements['submit']);
		
		$this->addDecorator('FormElements')
			->addDecorator('HtmlTag', 	array('tag' => 'div', 'class' => 'zend_form'))
			->addDecorator('Form')
			->setElementDecorators(array(
				array('ViewHelper'),
				array('Errors',			array('placement' => 'APPEND')),
				array('Description', 	array('tag' => 'em', 'class' => 'element-description', 'placement' => 'APPEND')),
				array('Label', 			array('separator' => ' ', 'placement' => 'PREPEND')),
				array('HtmlTag', 		array('tag' => 'div', 'class' => 'element')),
				),
				array_keys($elements)
			);	

		$this->setElementDecorators(array(
				array('ViewHelper'),				
				array('HtmlTag', 		array('tag' => 'div', 'class' => 'submit-group')),
				),
				array('submit')
			);
	
	}
    
}